#ifndef HEAP_H
#define HEAP_H

#include "stdio.h"
#include "stdlib.h"

#define DEFAULT_CAPACITY 10

typedef int ElemType;

typedef struct Heap {
    ElemType *data;
    int size;
    int capacity;
    int (*compare)(ElemType, ElemType);
} Heap;

Heap *createHeap();

Heap *createHeapWithCompare(int (*compare)(ElemType, ElemType));

void insert(Heap *heap, ElemType data);

ElemType extract(Heap *heap);

ElemType peek(const Heap *heap);

size_t heapSize(const Heap *heap);

int heapEmpty(const Heap *heap);

void heapSort(ElemType *data, int size);

void heapSortWithCompare(ElemType *data, int size,
                         int (*compare)(ElemType, ElemType));

void deleteHeap(Heap *heap);

#endif  // Heap_Include